﻿using System.Collections.Generic;

namespace FileSecurityManager.BizLogic
{
    using FileSecurityManager.BizEntities;
    using FileSecurityManager.DataAccess.Repositories;

    public class RoleLogic : BaseLogic
    {
        /// <summary>
        /// Gets the roles.
        /// </summary>
        /// <returns>Available Roles</returns>
        public List<RoleModel> GetRoles()
        {
            using (var repository = new RoleLinq2SqlRepository())
            {
                return repository.GetAll();
            }
        }

        /// <summary>
        /// Gets the role by id.
        /// </summary>
        /// <param name="roleId">The role id.</param>
        /// <returns>Role model</returns>
        public RoleModel GetRoleById(int roleId)
        {
            using (var repository = new RoleLinq2SqlRepository())
            {
                return repository.GetById(roleId);
            }
        }
    }
}
